package com.reggie.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.reggie.pojo.AddressBook;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AddressBookDao extends BaseMapper<AddressBook> {

    @Update("update address_book set is_default = #{Default} where id = #{id}")
    int updateDefault(Long id,Integer Default);

    @Select("select * from address_book where is_default = 1;")
    AddressBook getDefault();

    @Select("select * from address_book where user_id = #{id};")
    AddressBook selectByUserId(Long id);
}
